import { Code } from '@/utils/http/type'

export const resultSuccess = (data = {}, msg: string = 'success', code: Code = Code.SUCCESS) => {
  return result(code, msg, data)
}

export const resultError = (msg: string = 'error', code: Code = Code.ERROR, data = {}) => {
  return result(code, msg, data)
}

export const result = (code: Code, msg: string = 'result', data = {}) => {
  return {
    code,
    msg,
    data,
  }
}
